package com.dao.qsl;

import com.bean.qsl.MaintianBean;
import com.util.qsl.Dbutil;
import org.springframework.stereotype.Repository;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

@Repository
public class Maintian {
      public  List<MaintianBean> getmaintian(){
            Dbutil d=new Dbutil();
            Connection c=null;

            List<MaintianBean> list=new ArrayList<>();
            try{
                 c=d.getConnection();

                 String sql="SELECT m.*,h.hname FROM  maintain m,household h where m.aid=h.aid and maintain_status='B' ";

                  PreparedStatement pr=c.prepareStatement(sql);

                  ResultSet rs=pr.executeQuery();

                  while (rs.next()){
                        MaintianBean m=new MaintianBean();

                        m.setWpddbh(rs.getString("maintain_id"));
                        m.setWxbh(rs.getString("maintain_id"));
                        m.setBz(rs.getString("maintain_content"));
                        m.setLxdh(rs.getString("maintain_phone"));
                        m.setSqsj(rs.getString("maintain_date"));
                        m.setHhname(rs.getString("hname"));
                        list.add(m);
                  }



            }catch (Exception e){
                  e.printStackTrace();
            }
            return  list;
      }
}
